<!DOCTYPE html>

<html lang="en" data-content_root="../">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <title>LINKER_TYPE &mdash; CMake 4.1.1 Documentation</title>

    <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=a2c47e09" />
    <link rel="stylesheet" type="text/css" href="../_static/cmake.css?v=4d06bd55" />
    
    <script src="../_static/documentation_options.js?v=e6a937a4"></script>
    <script src="../_static/doctools.js?v=9bcbadda"></script>
    <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
    
    <link rel="icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="LOCATION" href="LOCATION.html" />
    <link rel="prev" title="LINKER_LANGUAGE" href="LINKER_LANGUAGE.html" />
 

  </head><body>
    <input id="sidebar-check" type="checkbox" />
    <label id="sidebar-overlay" for="sidebar-check"></label>



    <div class="related relbar1" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="LOCATION.html" title="LOCATION"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="LINKER_LANGUAGE.html" title="LINKER_LANGUAGE"
             accesskey="P">previous</a> |</li>
  <li>
    <label class="sidebar-toggle" for="sidebar-check"></label>
  </li>
  <li class="rootlink">
    <img src="../_static/cmake-logo-16.png" width="16" height="16" alt=""/>
    <a href="https://cmake.org/">CMake 4.1.1</a>
    <span class="reldelim1"> &#187;</span>
  </li>
  <li>
    <a href="../index.html">Documentation</a> &#187;
  </li>

          <li class="nav-item nav-item-1"><a href="../manual/cmake-properties.7.html" accesskey="U">cmake-properties(7)</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">LINKER_TYPE</a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <section id="linker-type">
<span id="prop_tgt:LINKER_TYPE"></span><h1>LINKER_TYPE<a class="headerlink" href="#linker-type" title="Link to this heading">¶</a></h1>
<div class="versionadded">
<p><span class="versionmodified added">Added in version 3.29.</span></p>
</div>
<p>Specify which linker will be used for the link step. The property value may use
<span class="target" id="index-0-manual:cmake-generator-expressions(7)"></span><a class="reference internal" href="../manual/cmake-generator-expressions.7.html#manual:cmake-generator-expressions(7)" title="cmake-generator-expressions(7)"><code class="xref cmake cmake-manual docutils literal notranslate"><span class="pre">generator</span> <span class="pre">expressions</span></code></a>.</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is assumed that the linker specified is fully compatible with the default
one the compiler would normally invoke. CMake will not do any option
translation.</p>
</div>
<p>Linker types are case-sensitive and may only contain letters, numbers and
underscores. Linker types defined in all uppercase are reserved for CMake's own
built-in types. The pre-defined linker types are:</p>
<dl class="simple">
<dt><code class="docutils literal notranslate"><span class="pre">DEFAULT</span></code></dt><dd><p>This type corresponds to standard linking, essentially equivalent to the
<span class="target" id="index-0-prop_tgt:LINKER_TYPE"></span><a class="reference internal" href="#prop_tgt:LINKER_TYPE" title="LINKER_TYPE"><code class="xref cmake cmake-prop_tgt docutils literal notranslate"><span class="pre">LINKER_TYPE</span></code></a> target property not being set at all.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">SYSTEM</span></code></dt><dd><p>Use the standard linker provided by the platform or toolchain. For example,
this implies the Microsoft linker for all MSVC-compatible compilers.
This type is supported for the following platform-compiler combinations:</p>
<ul class="simple">
<li><p>Linux: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">LLVMFlang</span></code>, <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code>
compilers.</p></li>
<li><p>Apple platforms: <code class="docutils literal notranslate"><span class="pre">AppleClang</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code>
compilers.</p></li>
<li><p>Windows: <code class="docutils literal notranslate"><span class="pre">MSVC</span></code>, <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code> compilers.</p></li>
</ul>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">LLD</span></code></dt><dd><p>Use the <code class="docutils literal notranslate"><span class="pre">LLVM</span></code> linker. This type is supported for the following
platform-compiler combinations:</p>
<ul class="simple">
<li><p>Linux: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">LLVMFlang</span></code>, <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code>
compilers.</p></li>
<li><p>Apple platforms: <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">AppleClang</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code> compilers.</p></li>
<li><p>Windows: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code> with MSVC-like front-end, <code class="docutils literal notranslate"><span class="pre">Clang</span></code> with
GNU-like front-end, <code class="docutils literal notranslate"><span class="pre">MSVC</span></code>, <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code> with MSVC-like front-end,
and <code class="docutils literal notranslate"><span class="pre">Swift</span></code>.</p></li>
</ul>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">BFD</span></code></dt><dd><p>Use the <code class="docutils literal notranslate"><span class="pre">GNU</span></code> linker.  This type is supported for the following
platform-compiler combinations:</p>
<ul class="simple">
<li><p>Linux: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">LLVMFlang</span></code>, and <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code> compilers.</p></li>
<li><p>Windows: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code> with GNU-like front-end.</p></li>
</ul>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">GOLD</span></code></dt><dd><p>Supported on Linux platform with <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">LLVMFlang</span></code>,
<code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code> compilers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">MOLD</span></code></dt><dd><p>Use the <a class="reference external" href="https://github.com/rui314/mold">mold linker</a>. This type is
supported on the following platform-compiler combinations:</p>
<ul class="simple">
<li><p>Linux: <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>, <code class="docutils literal notranslate"><span class="pre">LLVMFlang</span></code>, and <code class="docutils literal notranslate"><span class="pre">NVIDIA</span></code> compilers.</p></li>
<li><p>Apple platforms: <code class="docutils literal notranslate"><span class="pre">Clang</span></code> and <code class="docutils literal notranslate"><span class="pre">AppleClang</span></code> compilers (acts as an
alias to the <a class="reference external" href="https://github.com/bluewhalesystems/sold">sold linker</a>).</p></li>
</ul>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">SOLD</span></code></dt><dd><p>Use the <a class="reference external" href="https://github.com/bluewhalesystems/sold">sold linker</a>. This type is only supported on Apple platforms
with <code class="docutils literal notranslate"><span class="pre">Clang</span></code> and <code class="docutils literal notranslate"><span class="pre">AppleClang</span></code> compilers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">APPLE_CLASSIC</span></code></dt><dd><p>Use the Apple linker in the classic behavior (i.e. before <code class="docutils literal notranslate"><span class="pre">Xcode</span> <span class="pre">15.0</span></code>).
This type is only supported on Apple platforms with <code class="docutils literal notranslate"><span class="pre">GNU</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code>,
<code class="docutils literal notranslate"><span class="pre">AppleClang</span></code>, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code> compilers.</p>
</dd>
<dt><code class="docutils literal notranslate"><span class="pre">MSVC</span></code></dt><dd><p>Use the Microsoft linker. This type is only supported on the Windows
platform with <code class="docutils literal notranslate"><span class="pre">MSVC</span></code>, <code class="docutils literal notranslate"><span class="pre">Clang</span></code> with MSVC-like front-end, and <code class="docutils literal notranslate"><span class="pre">Swift</span></code>
compilers.</p>
</dd>
</dl>
<p>This property is not supported on <span class="target" id="index-0-generator:Green Hills MULTI"></span><a class="reference internal" href="../generator/Green%20Hills%20MULTI.html#generator:Green Hills MULTI" title="Green Hills MULTI"><code class="xref cmake cmake-generator docutils literal notranslate"><span class="pre">Green</span> <span class="pre">Hills</span> <span class="pre">MULTI</span></code></a> generator.</p>
<p>The implementation details for the selected linker will be provided by the
<span class="target" id="index-0-variable:CMAKE_&lt;LANG&gt;_USING_LINKER_&lt;TYPE&gt;"></span><a class="reference internal" href="../variable/CMAKE_LANG_USING_LINKER_TYPE.html#variable:CMAKE_&lt;LANG&gt;_USING_LINKER_&lt;TYPE&gt;" title="CMAKE_&lt;LANG&gt;_USING_LINKER_&lt;TYPE&gt;"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_&lt;LANG&gt;_USING_LINKER_&lt;TYPE&gt;</span></code></a> variable. For example:</p>
<div class="highlight-cmake notranslate"><div class="highlight"><pre><span></span><span class="nf">add_library(</span><span class="nb">lib1</span><span class="w"> </span><span class="no">SHARED</span><span class="w"> </span><span class="p">...</span><span class="nf">)</span>
<span class="nf">set_property(</span><span class="no">TARGET</span><span class="w"> </span><span class="nb">lib1</span><span class="w"> </span><span class="no">PROPERTY</span><span class="w"> </span><span class="no">LINKER_TYPE</span><span class="w"> </span><span class="no">LLD</span><span class="nf">)</span>
</pre></div>
</div>
<p>This specifies that <code class="docutils literal notranslate"><span class="pre">lib1</span></code> should use linker type <code class="docutils literal notranslate"><span class="pre">LLD</span></code> for the link step.
The command line options that will be passed to the toolchain will be provided
by the <code class="docutils literal notranslate"><span class="pre">CMAKE_&lt;LANG&gt;_USING_LINKER_LLD</span></code> variable.</p>
<p>Note that the linker would typically be set using <span class="target" id="index-0-variable:CMAKE_LINKER_TYPE"></span><a class="reference internal" href="../variable/CMAKE_LINKER_TYPE.html#variable:CMAKE_LINKER_TYPE" title="CMAKE_LINKER_TYPE"><code class="xref cmake cmake-variable docutils literal notranslate"><span class="pre">CMAKE_LINKER_TYPE</span></code></a>
for the whole build rather than setting the <code class="docutils literal notranslate"><span class="pre">LINKER_TYPE</span></code> property on
individual targets.</p>
</section>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="Main">
        <div class="sphinxsidebarwrapper">
  <div>
    <h4>Previous topic</h4>
    <p class="topless"><a href="LINKER_LANGUAGE.html"
                          title="previous chapter">LINKER_LANGUAGE</a></p>
  </div>
  <div>
    <h4>Next topic</h4>
    <p class="topless"><a href="LOCATION.html"
                          title="next chapter">LOCATION</a></p>
  </div>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../_sources/prop_tgt/LINKER_TYPE.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<search id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
      <input type="submit" value="Go" />
    </form>
    </div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="Related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="LOCATION.html" title="LOCATION"
             >next</a> |</li>
        <li class="right" >
          <a href="LINKER_LANGUAGE.html" title="LINKER_LANGUAGE"
             >previous</a> |</li>
  <li>
    <label class="sidebar-toggle" for="sidebar-check"></label>
  </li>
  <li class="rootlink">
    <img src="../_static/cmake-logo-16.png" width="16" height="16" alt=""/>
    <a href="https://cmake.org/">CMake 4.1.1</a>
    <span class="reldelim1"> &#187;</span>
  </li>
  <li>
    <a href="../index.html">Documentation</a> &#187;
  </li>

          <li class="nav-item nav-item-1"><a href="../manual/cmake-properties.7.html" >cmake-properties(7)</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href="">LINKER_TYPE</a></li> 
      </ul>
    </div>

    <div class="footer" role="contentinfo">
    &#169; Copyright 2000-2025 Kitware, Inc. and Contributors.
      Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 8.1.3.
    </div>
<script type="text/javascript">
(function() {
  "use strict";
  const hide = () => document.getElementById("sidebar-check").checked = false;
  addEventListener("keydown", e => (e.key === "Escape") && hide());
  addEventListener("click", e => (e.target.tagName === "A") && hide());
  addEventListener("hashchange", hide)
})();
</script>
  </body>
</html>